﻿ using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Hotel.Application.Dics.Dto;
using Hotel.Repositories;
using Hotel.Domain;
using AutoMapper;
using Hotel.Application.Dics;
using Hotel.Application.Menus;

namespace Hotel.Application.BackgroundServices
{
    public class InitDataBackgroundService : BackgroundService
    {
        private readonly IMenuService menuService;
        private readonly IDicService dicService;

        public InitDataBackgroundService(
            IMenuService menuService,
            IDicService dicService
        )
        {
            this.menuService = menuService;
            this.dicService = dicService;
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            await dicService.QueryAsync();
            await menuService.QueryAsync();
        }
    }
}
